

import 'package:dio/dio.dart';
import 'package:my_app/features/auth/domain/auth_repository.dart';
import 'package:my_app/features/auth/domain/user.dart';

class AuthApi implements AuthRepository {
  final Dio dio;
  AuthApi(this.dio);

  @override
  Future<User> login(String email, String pwd) async {
    final res = await dio.post('/login', data: {'email': email, 'password': pwd});
    return User.fromJson(res.data);
  }

  @override
  Future<void> logout() async => dio.post('/logout');
}
